home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / Include / sun4c.md / vmSunConst.h < prev   
C/C++ Source or Header  |  1991-07-28  |  18KB  |  477 lines

  1. /*
  2.  * vmSunConst.h --
  3.  *
  4.  *         Virtual memory constants for the Sun4.
  5.  *
  6.  * Copyright (C) 1985 Regents of the University of California
  7.  * All rights reserved.
  8.  *
  9.  *
  10.  * $Header: /sprite/src/kernel/vm/sun4.md/RCS/vmSunConst.h,v 9.6 91/07/26 17:12:46 shirriff Exp $ SPRITE (Berkeley)
  11.  */
  12.  
  13. #ifndef _VMSUNCONST
  14. #define _VMSUNCONST
  15.  
  16. /*
  17.  * Sun3 page table entry masks.  The same for the sun4.
  18.  *
  19.  *    VMMACH_RESIDENT_BIT    The page is physical resident.        31
  20.  *    VMMACH_PROTECTION_FIELD    Access to the protection bits.        30:29
  21.  *    VMMACH_KR_PROT        Kernel read only, user no access.
  22.  *    VMMACH_KRW_PROT        Kernel read/write, user no access.
  23.  *    VMMACH_UR_PROT        Kernel read only, user read only
  24.  *    VMMACH_URW_PROT        Kernel read/write, user read/write.
  25.  *    VMMACH_DONT_CACHE_BIT    Don't cache bit.            28
  26.  *    VMMACH_TYPE_FIELD        The memory type field.            27:26
  27.  *    VMMACH_REFERENCED_BIT    Referenced bit.                25
  28.  *    VMMACH_MODIFIED_BIT    Modified bit.                24
  29.  *    VMMACH_PAGE_FRAME_FIELD    The hardware page frame.        18:0
  30.  */
  31. #define    VMMACH_RESIDENT_BIT    0x80000000
  32. #define    VMMACH_PROTECTION_FIELD    0x60000000
  33. #define    VMMACH_UR_PROT        0x00000000
  34. #define    VMMACH_KR_PROT        0x20000000
  35. #define VMMACH_URW_PROT        0x40000000
  36. #define    VMMACH_KRW_PROT        0x60000000
  37. #define    VMMACH_DONT_CACHE_BIT    0x10000000
  38. #define    VMMACH_TYPE_FIELD    0x0c000000
  39. #define VMMACH_REFERENCED_BIT    0x02000000
  40. #define    VMMACH_MODIFIED_BIT    0x01000000
  41. #ifdef sun4c
  42. #define VMMACH_PAGE_FRAME_FIELD    0x0000ffff
  43. #else
  44. #define VMMACH_PAGE_FRAME_FIELD    0x0007ffff
  45. #endif
  46. /*
  47.  * Shift to allow the type field to get set.
  48.  */
  49. #define    VmMachGetPageType(pte) (((pte) >> 26) & 3)
  50. #define    VmMachSetPageType(pte, type) (pte |= (type << 26))
  51.  
  52. /*
  53.  * Shift pte right by this much to isolate page protection and residence bits.
  54.  */
  55. #define    VMMACH_PAGE_PROT_SHIFT    29
  56. /*
  57.  * Compare shifted pte (above) with this to see if user residence and protection
  58.  * are okay for the user to write to this address.
  59.  */
  60. #define    VMMACH_PTE_OKAY_VALUE    6
  61.  
  62. /*
  63.  * In the sun4 200 series machines, the 2 high bits may be 00 or 11.  However,
  64.  * 00 and 11 actually go to the same entry in the segment table.  So for
  65.  * address comparisons, one may have to strip the high two bits.  The hole in
  66.  * the sun4c space is the same.
  67.  *    VMMACH_BOTTOM_OF_HOLE    first unusable addr in hole
  68.  *    VMMACH_TOP_OF_HOLE    last unusable addr in hole
  69.  *    VMMACH_ADDR_MASK    mask off usable bits of address
  70.  */
  71. #define    VMMACH_BOTTOM_OF_HOLE    0x20000000
  72. #define    VMMACH_TOP_OF_HOLE    (0xe0000000 - 1)
  73. #define    VMMACH_ADDR_MASK    0x3FFFFFFF
  74.  
  75. /*
  76.  * Check to see if a virtual address falls inside the hole in the middle
  77.  * of the sun4 address space.
  78.  */
  79. #define    VMMACH_ADDR_CHECK(virtAddr)    \
  80.     (    ((unsigned int) (virtAddr)) >=    \
  81.             ((unsigned int) VMMACH_BOTTOM_OF_HOLE) &&    \
  82.     ((unsigned int) (virtAddr)) <=    \
  83.             ((unsigned int) VMMACH_TOP_OF_HOLE) ? FALSE : TRUE)
  84.  
  85. /*
  86.  * Check, in assembly, whether a virtual address falls inside the hole in
  87.  * the middle of the sun4 address space.
  88.  */
  89. #define    VMMACH_ADDR_OK_ASM(virtAddr, CheckMore, DoneCheck, answerReg, useReg) \
  90.     clr    answerReg;                \
  91.     set    VMMACH_BOTTOM_OF_HOLE, useReg;        \
  92.     cmp     useReg, virtAddr;            \
  93.     bleu    CheckMore;                \
  94.     nop;                        \
  95.     ba    DoneCheck;                \
  96.     nop;                        \
  97. CheckMore:                        \
  98.     set    VMMACH_TOP_OF_HOLE, useReg;        \
  99.     cmp    virtAddr, useReg;            \
  100.     bgu    DoneCheck;                \
  101.     nop;                        \
  102.     set    0x1, answerReg;                \
  103. DoneCheck:
  104.  
  105.  
  106. /*
  107.  * Sun memory management unit constants:
  108.  *
  109.  * VMMACH_KERN_CONTEXT        The Kernel's context.
  110.  * VMMACH_NUM_CONTEXTS        The number of contexts. Impl. dependent.
  111.  * VMMACH_NUM_SEGS_PER_CONTEXT    The number of hardware segments per context.
  112.  * VMMACH_NUM_PAGES_PER_SEG_INT    The number of pages per hardware segment.
  113.  * VMMACH_NUM_PAGE_MAP_ENTRIES    The number of hardware page map entries.
  114.  * VMMACH_NUM_PMEGS        The number of page clusters that there are 
  115.  *                in the system.
  116.  * VMMACH_DEV_START_ADDR        The first virtual address that is used for
  117.  *                              mapping devices.
  118.  * VMMACH_DEV_END_ADDR        The last virtual address that could be used for 
  119.  *                mapping devices.
  120.  * VMMACH_DMA_START_ADDR    The first virtual address that is used for 
  121.  *                DMA buffers by devices.
  122.  * VMMACH_DMA_SIZE        The amount of space devoted to DMA buffers
  123.  *
  124.  * VMMACH_32BIT_DMA_START_ADDR    The first address of the 32-bit "user" DVMA
  125.  *                area in context 0.
  126.  * VMMACH_32BIT_DMA_SIZE    The size of the 32-bit "user" DVMA area.  This
  127.  *                should be a multiple of the cache size, for
  128.  *                alignment purposes, and it should be a multile
  129.  *                of the segment size, so as not to waste aPpMEG.
  130.  * VMMACH_VME_ADDR_BIT        The bit that indicates an address is a VME
  131.  *                bus address.
  132.  * VMMACH_NET_MAP_START        The beginning of space for mapping the Intel
  133.  *                and AMD drivers.
  134.  * VMMACH_NET_MEM_START        The beginning of space for memory for the Intel
  135.  *                and AMD drivers.
  136.  * VMMACH_FIRST_SPECIAL_SEG    The first hardware segment that is used for 
  137.  *                mapping devices.
  138.  * VMMACH_INV_PMEG           The page cluster number that is used to 
  139.  *                represent an invalid Pmeg.
  140.  * VMMACH_INV_SEG           The hardware segment number that is used to
  141.  *                represent an invalid hardware segment.
  142.  * VMMACH_INV_CONTEXT       The context number that is used to represent
  143.  *                an invalid context.
  144.  */
  145.  
  146. #define VMMACH_KERN_CONTEXT        0
  147. #ifdef sun4c
  148. #define VMMACH_NUM_CONTEXTS        8
  149. #else
  150. #define VMMACH_NUM_CONTEXTS        16
  151. #endif
  152.  
  153. /*
  154.  *    VMMACH_NUM_SEGS_PER_CONTEXT    Number of segments per context:
  155.  * There is a hole in the middle of the address space, so really there's only
  156.  * 2**12 segs per context, but having discontinuous maps is a pain, so we
  157.  * pretend it's all mappable, which means there's 2**14 segs per context, on
  158.  * the sun4.  This is calculated from 256K bytes per segment == 0x40000 bytes
  159.  * per segment == 2**18 bytes per segment into 2**32 bytes per context gives
  160.  * (32-18) == 14 segments per context.  The sparc station has the same number
  161.  * of segments per context since segments are the same size.
  162.  *    VMMACH_NUM_PAGES_PER_SEG_INT    Number of pages per segment
  163.  *                    (Implementation dependent)
  164.  *    VMMACH_NUM_PAGE_MAP_ENTRIES    Number of total page map entries
  165.  *    VMMACH_NUM_PMEGS        Number of pmegs
  166.  *    VMMACH_NUM_NET_SEGS        The number of segments used for mapping
  167.  *                    net scatter gather arrays aligned to
  168.  *                    avoid cache flushing.  This number is
  169.  *                    picked by rule of thumb.  Usually there
  170.  *                    are no more than 5 elements in a
  171.  *                    scatter gather array, so 5 segments
  172.  *                    avoids cache flushing.  The 6th segment
  173.  *                    is for mapping any elements beyond this
  174.  *                    consecutively (cache flushing used).
  175.  *    
  176.  */
  177. #define VMMACH_NUM_SEGS_PER_CONTEXT    0x4000    /* 2**14 */
  178.  
  179. #ifdef sun4c
  180. #define VMMACH_NUM_PAGES_PER_SEG_INT    64
  181. #define    VMMACH_NUM_PMEGS        128
  182. #define VMMACH_NUM_PAGE_MAP_ENTRIES    (VMMACH_NUM_PMEGS * VMMACH_NUM_PAGES_PER_SEG_INT)
  183. #else
  184. #define VMMACH_NUM_PAGES_PER_SEG_INT    32
  185. #define VMMACH_NUM_PAGE_MAP_ENTRIES    16384
  186. #define    VMMACH_NUM_PMEGS        (VMMACH_NUM_PAGE_MAP_ENTRIES / VMMACH_NUM_PAGES_PER_SEG_INT)
  187. #endif
  188.  
  189. /* The values of MONSTART and MONEND */
  190. #define VMMACH_DEV_START_ADDR           0xFFD00000
  191. #define    VMMACH_DEV_END_ADDR        0xFFEFFFFF
  192. #define    VMMACH_DMA_START_ADDR        0xFFF00000
  193. #define    VMMACH_DMA_SIZE            0xC0000
  194. #define VMMACH_32BIT_DMA_START_ADDR    0x40000
  195. #define    VMMACH_32BIT_DMA_SIZE        0x800000
  196. #ifdef NOTDEF
  197. /* For raid only */
  198. #define    VMMACH_32BIT_DMA_SIZE        (VMMACH_NUM_PMEGS / 2 * VMMACH_SEG_SIZE)
  199. #endif
  200.  
  201. #define    VMMACH_VME_ADDR_BIT        0x80000000
  202.  
  203. #define    VMMACH_NUM_NET_SEGS        6
  204. #define VMMACH_NET_MAP_START        (VMMACH_DEV_START_ADDR -    \
  205.                 (VMMACH_NUM_NET_SEGS * VMMACH_SEG_SIZE))
  206. #define    VMMACH_NET_MAP_SIZE        (VMMACH_NUM_NET_SEGS * VMMACH_SEG_SIZE)
  207. #define VMMACH_NET_MEM_START        (VMMACH_DMA_START_ADDR +    \
  208.                         VMMACH_DMA_SIZE)
  209. #define    VMMACH_NET_MEM_SIZE        (0x20000-VMMACH_PAGE_SIZE)
  210. #define    VMMACH_FIRST_SPECIAL_SEG    (((unsigned int) VMMACH_DEV_START_ADDR) >> VMMACH_SEG_SHIFT)
  211.                         /* why is this one - 1??? */
  212. #define    VMMACH_INV_PMEG            (VMMACH_NUM_PMEGS - 1)
  213. #define    VMMACH_INV_SEG            VMMACH_NUM_SEGS_PER_CONTEXT
  214. #define    VMMACH_INV_CONTEXT        VMMACH_NUM_CONTEXTS
  215.  
  216. /*
  217.  * Function code constants for access to the different address spaces as
  218.  * defined by the Sun 4 hardware.  These constants determine which
  219.  * address space is accessed when using a load alternate or store alternate
  220.  * or swap alternate instruction.
  221.  *
  222.  * VMMACH_USER_DATA_SPACE        User data space.
  223.  * VMMACH_USER_PROGRAM_SPACE        User program space
  224.  * VMMACH_KERN_DATA_SPACE        Kernel data space.
  225.  * VMMACH_KERN_PROGRAM_SPACE        Kernel program space.
  226.  * VMMACH_FLUSH_SEG_SPACE        Flush segment (in control space).
  227.  * VMMACH_FLUSH_PAGE_SPACE        Flush page (in control space).
  228.  * VMMACH_FLUSH_CONTEXT_SPACE        Flush context (in control space).
  229.  * VMMACH_CACHE_DATA_SPACE        Cache data instruction (in cntrl space).
  230.  * VMMACH_CONTROL_SPACE            Other parts of control space, including
  231.  *                        the context register, etc.
  232.  * VMMACH_SEG_MAP_SPACE            Segment map (in control space).
  233.  * VMMACH_PAGE_MAP_SPACE        Page map (in control space).
  234.  */
  235.  
  236. #define    VMMACH_CONTROL_SPACE        0x2    /* also called system space */
  237. #define    VMMACH_SEG_MAP_SPACE        0x3
  238. #define    VMMACH_PAGE_MAP_SPACE        0x4
  239. #define    VMMACH_USER_PROGRAM_SPACE    0x8
  240. #define    VMMACH_KERN_PROGRAM_SPACE    0x9
  241. #define    VMMACH_USER_DATA_SPACE        0xA
  242. #define    VMMACH_KERN_DATA_SPACE        0xB
  243. #define    VMMACH_FLUSH_SEG_SPACE        0xC
  244. #define    VMMACH_FLUSH_PAGE_SPACE        0xD
  245. #define    VMMACH_FLUSH_CONTEXT_SPACE    0xE
  246. #ifndef sun4c
  247. #define    VMMACH_CACHE_DATA_SPACE        0xF    /* not on sun4c */
  248. #endif
  249.  
  250. /*
  251.  * Masks for access to different parts of control and device space.
  252.  *
  253.  * VMMACH_CONTEXT_OFF         Offset to context register in control space.
  254.  * VMMACH_DIAGNOSTIC_REG    The address of the diagnostic register.
  255.  * VMMACH_USER_DVMA_ENABLE_REG  Bits to enable user DVMA for different VME 
  256.  *                context.
  257.  * VMMACH_USER_DVMA_MAP        Map of VME context to sun user contexts.
  258.  * VMMACH_BUS_ERROR_REG        The address of the bus error register.
  259.  * VMMACH_ADDR_ERROR_REG    Addr of register storing addr of mem error.
  260.  * VMMACH_ADDR_CONTROL_REG    Addr of control register for memory errors.
  261.  * VMMACH_SYSTEM_ENABLE_REG    The address of the system enable register.
  262.  * VMMACH_ETHER_ADDR        Address of ethernet address in the id prom.
  263.  *                On the sun4c, this is in NVRAM in device space
  264.  *                instead.
  265.  * VMMACH_MACH_TYPE_ADDR    Address of machine type in the id prom.
  266.  *                On sun4c, this is in NVRAM.
  267.  * VMMACH_IDPROM_INC        Amount to increment an address when stepping
  268.  *                through the id prom.
  269.  * VMMACH_CACHE_TAGS_ADDR    Address of cache tags in control space.
  270.  * VMMACH_SYNC_ERROR_REG    Address of sync error reg on sun4c.
  271.  * VMMACH_SYNC_ERROR_ADDR_REG    Address of sync error addr reg on sun4c.
  272.  * VMMACH_ASYNC_ERROR_REG    Address of async error reg on sun4c.
  273.  * VMMACH_ASYNC_ERROR_ADDR_REG    Address of async error addr reg on sun4c.
  274.  */
  275.  
  276. #define    VMMACH_CONTEXT_OFF        0x30000000    /* control space */
  277. #define VMMACH_SYSTEM_ENABLE_REG    0x40000000    /* control space */
  278. #define    VMMACH_CACHE_TAGS_ADDR        0x80000000    /* control space */
  279. #define    VMMACH_SERIAL_PORT_ADDR        0xF0000000    /* control space */
  280.  
  281. #ifdef sun4c
  282. #define VMMACH_IDPROM_INC        0x01
  283. #define VMMACH_MACH_TYPE_ADDR        0xffd047d9    /* device space */
  284. #define VMMACH_ETHER_ADDR        0xffd047da    /* device space */
  285. /* 4 bus error registers */
  286. #define    VMMACH_CACHE_DATA_ADDR        0x90000000    /* control space */
  287. #define VMMACH_SYNC_ERROR_REG        0x60000000    /* control space */
  288. #define VMMACH_SYNC_ERROR_ADDR_REG    0x60000004    /* control space */
  289. #define VMMACH_ASYNC_ERROR_REG        0x60000008    /* control space */
  290. #define VMMACH_ASYNC_ERROR_ADDR_REG    0x6000000C    /* control space */
  291. #else
  292. #define VMMACH_IDPROM_INC        0x01
  293. #define VMMACH_MACH_TYPE_ADDR        0x01
  294. #define VMMACH_ETHER_ADDR        0x02
  295. #define    VMMACH_USER_DVMA_ENABLE_REG    0x50000000      /* control space */
  296. #define VMMACH_BUS_ERROR_REG        0x60000000    /* control space */
  297. #define VMMACH_ADDR_ERROR_REG        0xffd08004    /* device space */
  298. #define VMMACH_ADDR_CONTROL_REG        0xffd08000    /* device space */
  299. #define VMMACH_DIAGNOSTIC_REG        0x70000000    /* control space */
  300. #define    VMMACH_USER_DVMA_MAP        0xD0000000    /* control space */
  301. /*
  302.  * Bit in address error control register to enable reporting of asynchronous
  303.  * memory errors.
  304.  */
  305. #define    VMMACH_ENABLE_MEM_ERROR_BIT    0x40
  306. #endif
  307.  
  308. /*
  309.  * Other cache constants:
  310.  */
  311. /*
  312.  * Mask to set enable cache bit in the system enable register.
  313.  * Or it with register to enable the cache.
  314.  *    VMMACH_ENABLE_CACHE_BIT        Bit in system enable register
  315.  *                    to turn on the cache.
  316.  *    VMMACH_NUM_CACHE_TAGS        Number of tags in the cache
  317.  *    VMMACH_CACHE_TAG_INCR        Byte size for incrementing thru tags
  318.  *    VMMACH_CACHE_LINE_SIZE        Line size in bytes
  319.  *    VMMACH_CACHE_SHIFT        Number to shift by to = line size
  320.  *    VMMACH_NUM_CACHE_LINES        Number of lines in cache
  321.  *    VMMACH_CACHE_SIZE        Total size of cache in bytes of data
  322.  */
  323. #ifdef sun4c
  324. #define    VMMACH_NUM_CACHE_LINES        0x1000    /* 4K * 16 = 64K cache size */
  325. #else
  326. #define    VMMACH_NUM_CACHE_LINES        0x2000    /* 8K * 16 = 128K cache size */
  327. #endif
  328. #define    VMMACH_ENABLE_CACHE_BIT        0x10
  329. #define    VMMACH_CACHE_TAG_INCR        0x10
  330. #define    VMMACH_CACHE_LINE_SIZE        0x10
  331. #define    VMMACH_CACHE_SHIFT        0x4
  332. #define    VMMACH_NUM_CACHE_TAGS        VMMACH_NUM_CACHE_LINES
  333. #define VMMACH_CACHE_SIZE  (VMMACH_CACHE_LINE_SIZE * VMMACH_NUM_CACHE_LINES)
  334.  
  335. /*
  336.  * Other bits in the system enable register.
  337.  */
  338. #define    VMMACH_ENABLE_DVMA_BIT        0x20
  339.  
  340. /*
  341.  * The highest virtual address useable by the kernel for both machine type
  342.  * 1 and machine type 2 and 3 and 4...  This seems to be the largest
  343.  * virtual address plus 1...
  344.  */
  345. #define    VMMACH_MACH_TYPE1_MEM_END    0xF40000
  346. #define    VMMACH_MACH_TYPE2_MEM_END    0x1000000
  347. #define    VMMACH_MACH_TYPE3_MEM_END    0x10000000
  348. #define    VMMACH_MACH_TYPE4_MEM_END    0x100000000
  349.  
  350. /*
  351.  * Masks to extract good bits from the virtual addresses when accessing
  352.  * the page and segment maps.
  353.  */
  354. #ifdef sun4c
  355. #define    VMMACH_PAGE_MAP_MASK    0xFFFFF000
  356. #else
  357. #define    VMMACH_PAGE_MAP_MASK    0xFFFFe000
  358. #endif
  359. #define    VMMACH_SEG_MAP_MASK    0xFFFc0000
  360.  
  361. /*
  362.  * Mask to get only the low order four bits of a context register.
  363.  */
  364. #define    VMMACH_CONTEXT_MASK        0xF
  365.  
  366. /*
  367.  * Hardware dependent constants for pages and segments:
  368.  *
  369.  * VMMACH_CLUSTER_SIZE      The number of hardware pages per virtual page.
  370.  * VMMACH_CLUSTER_SHIFT     The log base 2 of VMMACH_CLUSTER_SIZE.
  371.  * VMMACH_PAGE_SIZE        The size of each virtual page.
  372.  * VMMACH_PAGE_SIZE_INT        The size of each hardware page.
  373.  * VMMACH_PAGE_SHIFT        The log base 2 of VMMACH_PAGE_SIZE.
  374.  * VMMACH_PAGE_SHIFT_INT    The log base 2 of VMMACH_PAGE_SIZE_INT
  375.  * VMMACH_OFFSET_MASK        Mask to get to the offset of a virtual address.
  376.  * VMMACH_OFFSET_MASK_INT    Mask to get to the offset of a virtual address.
  377.  * VMMACH_PAGE_MASK        Mask to get to the Hardware page number within a
  378.  *                hardware segment.
  379.  * VMMACH_SEG_SIZE        The size of each hardware segment.
  380.  * VMMACH_SEG_SHIFT        The log base 2 of VMMACH_SEG_SIZE.
  381.  * VMMACH_NUM_PAGES_PER_SEG    The number of virtual pages per segment.
  382.  */
  383.  
  384. #define VMMACH_CLUSTER_SIZE     1
  385. #define VMMACH_CLUSTER_SHIFT    0
  386. #define VMMACH_PAGE_SIZE        (VMMACH_CLUSTER_SIZE * VMMACH_PAGE_SIZE_INT)
  387. #ifdef sun4c
  388. #define    VMMACH_PAGE_SIZE_INT    4096
  389. #define VMMACH_PAGE_SHIFT_INT    12
  390. #define VMMACH_OFFSET_MASK    0x0fff
  391. #define VMMACH_OFFSET_MASK_INT    0x0fff
  392. #define VMMACH_PAGE_MASK    0x3F000    
  393. #else
  394. #define    VMMACH_PAGE_SIZE_INT    8192
  395. #define VMMACH_PAGE_SHIFT_INT    13
  396. #define VMMACH_OFFSET_MASK    0x1fff
  397. #define VMMACH_OFFSET_MASK_INT    0x1fff
  398. #define VMMACH_PAGE_MASK    0x3E000    
  399. #endif
  400.  
  401. #define VMMACH_PAGE_SHIFT    (VMMACH_CLUSTER_SHIFT + VMMACH_PAGE_SHIFT_INT)
  402. #define    VMMACH_SEG_SIZE        0x40000        /* twice as large as sun3? */
  403. #define VMMACH_SEG_SHIFT    18        /* twice as large as sun3? */
  404. #define    VMMACH_NUM_PAGES_PER_SEG (VMMACH_NUM_PAGES_PER_SEG_INT / VMMACH_CLUSTER_SIZE)
  405.  
  406. /*
  407.  * The size that page tables are to be allocated in.  This grows software
  408.  * segments in 256K chunks.  The page tables must grow in chunks that are 
  409.  * multiples of the hardware segment size.  This is because the heap and 
  410.  * stack segments grow towards each other in VMMACH_PAGE_TABLE_INCREMENT 
  411.  * sized chunks.  Thus if the increment wasn't a multiple of the hardware 
  412.  * segment size then the heap and stack segments could overlap on a 
  413.  * hardware segment.
  414.  */
  415. #define    VMMACH_PAGE_TABLE_INCREMENT    (((256 * 1024 - 1) / VMMACH_SEG_SIZE + 1) * VMMACH_NUM_PAGES_PER_SEG)
  416.  
  417. /*
  418.  * The maximum number of kernel stacks.  There is a limit because these
  419.  * use part of the kernel's virtual address space.
  420.  */
  421. #define VMMACH_MAX_KERN_STACKS    128
  422.  
  423. /*
  424.  * The following sets of constants define the kernel's virtual address space. 
  425.  * Some of the constants are defined in machineConst.h.  The address space 
  426.  * looks like the following:
  427.  *
  428.  *    |-------------------------------|    MACH_KERN_START
  429.  *    | Trap vectors.            |
  430.  *    |-------------------------------|    MACH_STACK_BOTTOM
  431.  *    | Invalid page.            |
  432.  *    |-------------------------------|    MACH_STACK_BOTTOM + VMMACH_PAGE_SIZE
  433.  *         |                |
  434.  *         | Stack for the initial kernel     |
  435.  *         | process.            |
  436.  *         |                |
  437.  *    ---------------------------------    MACH_CODE_START
  438.  *         |                |
  439.  *         | Kernel code and data        |
  440.  *         |                 |
  441.  *    ---------------------------------    VMMACH_PMEG_SEG
  442.  *    |                 |
  443.  *    | Stacks, mapped pages, etc.    |
  444.  *    |                 |
  445.  *      ---------------------------------    VMMACH_DEV_START_ADDR
  446.  *    |                |
  447.  *    | Mapped in devices        |
  448.  *    |                |    VMMACH_DEV_END_ADDR
  449.  *    |-------------------------------|    VMMACH_DMA_START_ADDR
  450.  *    |                |
  451.  *    | Space for mapping in DMA bufs |
  452.  *    |                |
  453.  *    |-------------------------------|
  454.  */
  455.  
  456. /*
  457.  * There is a special area of a users VAS to allow copies between two user
  458.  * address spaces.  This area sits between the beginning of the kernel and
  459.  * the top of the user stack.  It is one hardware segment wide.
  460.  */
  461. #define    VMMACH_MAP_SEG_ADDR        (MACH_KERN_START - VMMACH_SEG_SIZE)
  462.  
  463. /*
  464.  * Definitions for shared memory.
  465.  * VMMACH_USER_SHARED_PAGES is the number of pages allocated for shared
  466.  *    memory.
  467.  * VMMACH_SHARED_BLOCK_SIZE is the block size in which shared memory is
  468.  *    allocated.  This is a multiple of 128K to avoid cache aliasing.
  469.  * VMMACH_SHARED_START ADDR is the address at which shared memory starts.
  470.  */
  471. #define VMMACH_USER_SHARED_PAGES    8192
  472. #define VMMACH_SHARED_BLOCK_SIZE    VMMACH_SEG_SIZE
  473. #define VMMACH_SHARED_START_ADDR    (0x20000000 - VMMACH_USER_SHARED_PAGES*VMMACH_PAGE_SIZE)
  474. #define    VMMACH_SHARED_NUM_BLOCKS    (VMMACH_USER_SHARED_PAGES*VMMACH_PAGE_SIZE/VMMACH_SHARED_BLOCK_SIZE)
  475.  
  476. #endif /* _VMSUNCONST */
  477.